<template>
	<div class="announcementListDetail_container pl-1 pr-1">
		<div class="announcementListDetail_container_title mb-2">
			<div class="announcementList_container_list_title fs-lh-2 font-left">
				{{ announcement.title }}
			</div>
			<div class="announcementList_container_list_date font-left">
				{{ announcement.date }}
			</div>
		</div>
		<div class="announcementListDetail_container_content" v-html="announcementContent"></div>
	</div>
</template>

<script>
import { getAnnounceDetail } from "@/request/homePage"
export default {
	name: "AnnouncementListDetail",
	data(){
		return {
			id:'',
			announcement:{
				title: '',
				date:new Date().toLocaleString()
			},
			content:''
		}
	},
	computed:{
		announcementContent(){
			return this.content.replace(/<p>/g,'<p class="fs-lh-1 fc-w font-left mb-1">')
		}
	},
	mounted(){
		this.id = this.$route.params.id
		this.getAnnouncementListDetail()
	},
	methods: {
		getAnnouncementListDetail(){
			// 请求公告列表详情页数据
			getAnnounceDetail({id:this.id}).then(res=>{
				if(res.code == 1){
					this.announcement = {
						title: res.data.zh_cn,
						date: res.data.createtime
					}
					this.content = res.data.zh_cn_text || res.data.text
				}
			})
		}
	}
};
</script>

<style>
</style>